//
//  WHVisTorTableViewController.swift
//  WHSinaWeiBo
//
//  Created by 王寒 on 16/4/8.
//  Copyright © 2016年 wanghan. All rights reserved.
//

import UIKit

class WHVisTorTableViewController: UITableViewController,WHVisitorLoginViewDelegate {
 
    var visitorView :WHVisitorLoginView?
    
    var userLogin = WHUserAccountViewModel.sharedAccountViewModel.userLogin
    
    override func loadView() {
        
         userLogin ? super.loadView() : loginCreatView()
    }
    
    private func loginCreatView(){
        visitorView = WHVisitorLoginView()
        visitorView?.visitorDelegate = self
        view = visitorView
       
        //创建按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "userWillLogin")
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "userWllResgister")
        
    }
    
    
    //登录
    func userWillLogin() {
        let oauth = WHOAurhViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
        
    }

    //注册
    func userWllResgister() {
        print("vcResgister")
    }
   
  

}
